#!/usr/bin/env ruby

# You might want to change this
ENV["RAILS_ENV"] ||= "production"

require File.dirname(__FILE__) + "/../../config/environment"

$running = true
Signal.trap("TERM") do 
  $running = false
end

while($running) do
  
	# Replace this with your code
	ActiveRecord::Base.logger.info "This daemon is still running at #{Time.now}.\n"
  
	Historico.gerar

	to_time = Time.now
	from_time = Time.now + 3600.seconds

	sleep ((to_time - from_time).abs).round

end